package com.cskaoyan.demo;

import com.cskaoyan.utils.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.MapListHandler;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

// MapListHandler
public class QueryRunnerDemo6 {

    public static void main(String[] args) throws SQLException {

        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());

        List<Map<String, Object>> mapList = queryRunner.query("select * from account where id > ?", new MapListHandler(), 1);

        for (Map<String, Object> map : mapList) {
            System.out.println(map.toString());
        }
    }
}
